/******************************************************************************************************
Copyright (C) 2020 Mestrelab Research S.L. All rights reserved.

This file is part of the MNova scripting toolkit.

Authorized users of MNova Software may use this file freely, but this file is provided AS IS
with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE.
*****************************************************************************************************/

/*globals mainWindow, draw, settings, MessageBox, File, Dir, TextStream */

/*jslint plusplus: true, indent: 4, continue:true, regexp: true, evil:true */

function ElViSProcessingActionsReporter(aCreateItem, parameters) {
	"use strict";

	//Check for constructor parameters
	if (parameters === undefined) {
		MessageBox.warning("In order to launch the script ElViS processing parameters must exist in the arguments list");
	}

//	MessageBox.warning("ElViSProcessingActionsReporter: parameters.length is: " + parameters.length);

	var result;
	result = {};

	var rawText;
	rawText = "Sequence of ElViS Processing Actions:\n\n";
	
	for (i = 0; i < parameters.length; i += 2) {
		if (parameters[i] === "uvirProcOpId"){
			rawText = rawText + parameters[i+1].toString() + "\n";
		} else {
			rawText = rawText + "\t" + parameters[i].toString() + " " + parameters[i+1].toString() + "\n";
		}
	}

	if (aCreateItem) {
		textItem = draw.text(rawText, "Report Special", "ElViS Processing", false);
		mainWindow.activeWindow().update();
		mainWindow.activeDocument.curPage().update();
	} else {
		result.plainText = rawText;
	}

//Return the results
//	if (isHTML) {
//		result.html = macrosResult;
//	} else {
//		result.plainText = macrosResult;
//	}

	return result;
};
